package com.spring.design.Objectadapter;
//适配器类
public class VoltageAdapter implements IVoltage5V{

    //聚合
    private Voltage220V voltage220V;

    public VoltageAdapter(Voltage220V voltage220V) {
        this.voltage220V = voltage220V;
    }

    public int output5V() {
        //
        int dst =0;
        if (voltage220V != null){
            int src = voltage220V.output220V();
            System.out.println("全用对象适配器进行转换");
            dst = src / 44 ;
            System.out.println("适配完成，输出的电压为："+dst);
        }
        return dst;
    }
}
